import physgin.*;
import java.applet.Applet;
import javax.swing.*;
import java.awt.*;
import com.sun.j3d.utils.applet.JMainFrame;

public class TestApp extends Applet
{
  J3dWorld w;
  BodyController b;
  
  public static void main(String[] args)
  {
    TestApp program = new TestApp();
    JMainFrame mf = new JMainFrame(program, 500, 500);
  }
  
  TestApp()
  {
    setLayout(new BorderLayout());
    w = new J3dWorld();
      w.setBackground("background1.jpg");
    b = new BodyController(w);
    Component c = (Component) w.getCanvas();
    add(c);

                                        //position(x&y), mass, size, velocity(x&y), orientation, elasticity
    //J3dBody ob5 = new J3dBody("monster.jpg",Shapes.SQUARE, 0.4f,0.4f, 3f,0.3f, 0.0f,0.0f ,0f,0.2f);
    J3dBody e = new J3dBody("circle.jpg",Shapes.CIRCLE, 1.3f,10.2f, 3f,0.3f, -1.5f,0.0f, 0f,.8f);
    //J3dBody k = new J3dBody("circle.jpg",Shapes.CIRCLE, 1.0f,5.0f, 2f,0.3f, -5.0f,0.0f, 0f,.8f);
      
    J3dBody f = new J3dBody("wall.jpg",Shapes.SQUARE, -1.5f,2.0f, 101f, 0.3f, 0f,0f, 0.0f, 0.0f);
    J3dBody g = new J3dBody("wall.jpg",Shapes.SQUARE, -0.9f,2.0f, 101f, 0.3f, 0f,0f, 0.0f, 0.0f);
    J3dBody h = new J3dBody("wall.jpg",Shapes.SQUARE, -0.3f,2.0f, 101f, 0.3f, 0f,0f, 0.0f, 0.0f);

    J3dBody x;
    //floor
    for (int i = 0; i < 11; i++)
    {
    x = new J3dBody("floor.jpg",Shapes.SQUARE, ((i*0.6f)-3.4f),-0.1f, 101f, 0.3f, 0f,0f, 0.0f, 0.0f);
    b.addBody(x);
    }
    
    //leftwall
    for (int i = 0; i < 10; i++)
    {
    x = new J3dBody("wall.jpg",Shapes.SQUARE, -2.8f,((i*0.6f) - 0.3f), 101f,0.3f, 0f,0f, 0.0f, 0.0f);
    b.addBody(x);
    }

    //b.addBody(ob5); 
    b.addBody(e);
    //b.addBody(k);
     
      //rightwall
      for (int i = 1; i < 10; i++)
      {
          x = new J3dBody("wall.jpg",Shapes.SQUARE, 2.6f,((i*0.6f) - 0.1f), 101f,0.3f, 0f,0f, 0.0f, 0.0f);
         b.addBody(x);
      }
      
    b.addBody(f);
    b.addBody(g);
    b.addBody(h);
      b.start(); 
  }
}
